// AYLA SETTINGS
// Ayla uses the Expresser platform, therefore I recommend having a look
// at https://expresser.codeplex.com to understand how settings work.
// The properties below are the defaults for Ayla, and do not include
// private API keys, tokens, passwords, user preferences etc. For this
// you'll have to create a settings.private.json file.

{
    // Web app defaults, please note that for SSL to work you'll need to have
    // a ssl.key and ssl.cer files. The `cookieTokenExpireDays` defines how
    // many days a token will be saved as cookie when user access the app
    // with a token and passing savecookie=1.
    "app": {
        "cookieTokenExpireDays": 30,
        "port": 8080,
        "ssl": {
            "enabled": false
        },
        "title": "Ayla"
    },
    // Camera date format while saving snaps, and max age of snaps before
    // they get deleted (default is 7).
    "camera": {
        "dateFormat": "YYYYMMDD-HHmmss",
        "snapsMaxAgeDays": 7
    },

    // Connect to local MongoDB and delete cached API data after 48 hours by default.
    "database": {
        "mongo": {
            "connString": "mongodb://localhost/ayla?auto_reconnect",
            "dataCacheExpireHours": 48,
            "normalizeId": false
        }
    },
    // Settings to connect to your Electric Imp devices. You must set a devices
    // array with the list of devices to be used.
    // Please note that you must use the Ayla Imp code on them,
    // both agent and device codes (available on our GIT repo under the /imp folder).
    "electricimp": {
        "agentUrl": "https://agent.electricimp.com/"
    },
    // Disable Expresser firewall by default.
    "firewall": {
        "enabled": false
    },
    // Fitbit options. Check if user is missing sleep data 2 and 5 days ago, if
    // weight hasn't been set for more than 10 days, and default date format is YEAR-MONTH-DAY.
    "fitbit": {
        // API clientId and secret must be set on the private settings file.
        "api": {
            "url": "https://api.fitbit.com/1/",
            "oauthUrl": "https://api.fitbit.com/oauth/",
            "oauthVersion": "1.0"
        },
        "missingSleepDays": [2, 5],
        "missingWeightAfterDays": 10,
        "dateFormat": "YYYY-MM-DD"
    },
    // Garmin Connect settings. The API `username` and `password` must be set on
    // your private settings file. The `recentDays` define how many days to get
    // recent sleep, activities and fitness stats data.
    "garmin": {
        "api": {
            "url": "http://connect.garmin.com/modern/proxy/",
            "loginUrl": "https://sso.garmin.com/sso/login?service=http%3A%2F%2Fconnect.garmin.com%2Fpost-auth%2Flogin&webhost=olaxpw-connect33&source=http%3A%2F%2Fconnect.garmin.com%2Fen-US%2Fsignin&redirectAfterAccountLoginUrl=http%3A%2F%2Fconnect.garmin.com%2Fpost-auth%2Flogin&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso&locale=en_US&id=gauth-widget&clientId=GarminConnect&openCreateAccount=false"
        },
        "recentDays": 30
    },
    // General app settings. Debug is disabled by default.
    "general": {
        "debug": false,
        // Maximum tasks to execute in parallel using async.
        "parallelTasksLimit": 4
    },
    // Home settings.
    "home": {
        // Auto control lights based on environment and user presence?
        "autoControlLights": true,
        // The ideal conditions are arrays of values [criticallyLow, low, high, criticallyHigh].
        "idealConditions": {
            "co2": [0, 400, 1200, 2800],
            "humidity": [30, 40, 65, 75],
            "temperature": [16, 18, 24, 26]
        },
        // Default timeout to auto turn off lights, in minutes (when house is empty for example).
        "lightsTimeout": 5,
        // Default timeout to turn off ventilator if it has been turned on automatically, in minutes.
        "ventilatorTimeout": 60
    },
    // Default settings for IMAP connections. Try connecting to accounts up to 3 times in a row,
    // with a delay of 90 seconds between retries. The `messageCacheSize` sets how many
    // email messages should be cached on memory (skippedEmails and processedEmails lists).
    "imap": {
        "maxRetry": 3,
        "messagesCacheSize": 10,
        "retryInterval": 90000,
        "tagProcessedMessages": "<strong>Message processed automatically by Ayla!</strong><br /><br />"
    },
    // Modules (API and managers) settings. You'll need to enable modules individually by
    // creating a `enable` property containing an array of modules to be enabled.
    // For example: "enabled": ["netatmo", "network", "toshl"]
    "modules": {
        // By default the app will keep the most recent 5 results of module
        // data having the same key (each key inside the .data property of API modules).
        "dataKeyCacheSize": 5,
        // Modules errors will stay logged on the module itself fogoor up to 48 hours.
        // Used to check module's health (for example if it's throwing too many errors).
        "errorMaxAgeHours": 48,
        // OAUth expired tokens will be saved for a week.
        "maxAuthTokenAgeDays": 7,
        // How long before trying to refresh an OAuth token again, in seconds.
        // Default represents 5 minutes.
        "minRefreshTokenIntervalSeconds": 300,
        // The `notifyExpireMinutes` is used to avoid sending repeated notifications.
        // By default it won't resend the same notification if last was sent less than 60 minutes ago.
        "notifyExpireMinutes": 60,
        // Call the module's `stop` method automatically if the same error
        // happens 10 times in less than 48 hours.
        "stopOnErrorCount": 10
    },
    // Netatmo settings. The API clientId, secret, password and username must
    // be set on the private settings file.
    "netatmo": {
        "api": {
            "url": "https://api.netatmo.net/api/",
            "oauthPathAuthorize": "oauth2/authorize",
            "oauthPathToken": "oauth2/token",
            "oauthUrl": "https://api.netatmo.net/",
            "oauthVersion": "2.0",
            "oauthPassRedirect": true
        }
    },
    // Network settings. You must defined a `router` object with router details like
    // ip, model, remoteHost etc, and a `devices` array containing a list of expected
    // devices on your network also with ip, description, localIp, localPort, remotePort etc.
    // Set `autoDiscovery` to false if you don't want to use MDNS to auto discover devices.
    "network": {
        "autoDiscovery": true
    },
    // Ninja Blocks API userToken must be set on the private settings file.
    "ninja": {
        "api": {
            "url": "https://a.ninja.is/rest/v0/"
        }
    },
    // Path to various settings and data.
    "path": {
        "cameraSnaps": "/data/cameraSnaps/",
        "data": "/data/",
        "emailTemplatesDir": "/data/emailTemplates/",
        // You'll need to get your own certificates if you want to use HTTPS!
        "sslKeyFile": "ssl.key",
        "sslCertFile": "ssl.cer"
    },
    // Strava settings. The `recentDays` by default is set to 30 days.
    "strava": {
        "api": {
            "url": "https://www.strava.com/api/v3/",
            "oauthPathAuthorize": "oauth/authorize",
            "oauthPathToken": "oauth/token",
            "oauthPassRedirect": true,
            "oauthResponseType": "code",
            "oauthUrl": "https://www.strava.com/",
            "oauthVersion": "2.0"
        },
        "recentDays": 30
    },
    // Toshl settings. The API clientId, secret and oauthState must be set on the private settings file.
    // The `recentDays` by default is set to 30 days.
    "toshl": {
        "api": {
            "url": "https://api.toshl.com/",
            "oauthPathAuthorize": "oauth2/authorize",
            "oauthPathToken": "oauth2/token",
            "oauthResponseType": "code",
            "oauthUrl": "https://toshl.com/",
            "oauthVersion": "2.0",
            "oauthUseHeader": true
        },
        "recentDays": 30,
        "dateFormat": "YYYY-MM-DD"
    },
    // Ubi settings. API clientId and secret must be set on the private settings file.
    "ubi": {
        "api": {
            "url": "https://portal.theubi.com/v2/ubi/",
            "oauthPathAuthorize": "oauth/authorize",
            "oauthPathToken": "oauth/token",
            "oauthPassRedirect": true,
            "oauthResponseType": "code",
            "oauthUrl": "https://portal.theubi.com/",
            "oauthVersion": "2.0"
        }
    },
    // Withings settings. API clientId and secret must be set on the private settings file,
    // along with the account userId.
    "withings": {
        "api": {
            "url": "http://wbsapi.withings.net/",
            "oauthUrl": "https://oauth.withings.com/account/",
            "oauthVersion": "1.0"
        },
        "recentDays": 30
    },
    // Weather Underground settings. You must set the api.clientId and defaultQuery.
    "wunderground": {
        "api": {
            "url": "http://api.wunderground.com/api/"
        }
    }
}
